package fr.snac.serialization;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

import fr.snac.utils.Constants;
import fr.snac.utils.FilesUtil;


public class InfosDeserializer {
	
	Infos infos;
	
	public InfosDeserializer(){}
	
	public boolean deSerialize(){
		
		try {
			FileInputStream postFile = new FileInputStream(FilesUtil.getPostFolderPath() + "/" + Constants.BM_FILENAME_INFOS + ".ser");
			ObjectInputStream ois = new ObjectInputStream(postFile);
			infos = (Infos)ois.readObject();
			ois.close();
			
			return true;
		} catch (IOException e) {
			return false;
		} catch (ClassNotFoundException e) {
			return false;
		}
	}
	
	public Infos getInfos(){
		return infos;
	}

}
